﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Toolkit.Web.Infastructure;
using Toolkit.Web.ExtensionMethods;
using System.Web;
using Toolkit.Web.Resources;

namespace Toolkit.Web.ViewComponents.DataGrid
{
    public sealed class DataGridResetHelper<T> where T : class
    {
        public DataGridResetHelper(IReadOnlyDataGrid<T> dataGrid)
        {
            if (dataGrid == null)
            {
                throw new ArgumentNullException("dataGrid");
            }

            ReadOnlyDataGrid = dataGrid;
        }

        public IReadOnlyDataGrid<T> ReadOnlyDataGrid
        {
            get;
            private set;
        }

        public IHtmlString DefaultResetTrigger()
        {
            StringBuilder markup = new StringBuilder();
            markup.AppendFormat(@"<div class=""vc-dg-reset"" title=""{0}""><span class=""vc-icon""></span></div>", HttpUtility.HtmlEncode(Language.ViewComponents_DataGrid_Reset));

            return HtmlStringExtensions.Create(markup.ToString());
        }
    }
}
